package android.slc.appbase.utils.process;

import android.slc.commonlibrary.CacheDiskUtils;
import android.slc.commonlibrary.CacheDoubleUtils;
import android.slc.commonlibrary.CacheMemoryUtils;
import android.slc.utils.SlcPathUtils;

public class ProcessSp {
    public static String SP_NAME = "process";

    private static CacheDoubleUtils getSPUtils() {
        return CacheDoubleUtils.getInstance(CacheMemoryUtils.getInstance(), CacheDiskUtils.getInstance(SlcPathUtils.createAppDbFile(SP_NAME)));
    }

    public static Long getProcessId() {
        try {
            return Long.valueOf(getSPUtils().getString("processId"));
        } catch (NullPointerException | NumberFormatException e) {
            return null;
        }
    }

    public static void saveProcessId(Long account) {
        getSPUtils().put("processId", account == null ? "" : account.toString());
    }


}
